import axios from "axios";

const BackEnd_URL = "http://localhost:9999";

function getTest() {

    let fd = new FormData();

    fd.append("UserName", "ABC");
    fd.append("Password", "123");
    return axios({
        url: "http://172.16.55.78:8081/test",
        method: "POST",
        data: fd
    });

}

function userLogin(userEmail, userPassword) {
    let fd = new FormData();
    fd.append("UserEmail", userEmail);
    fd.append("Password", userPassword);
    let api_url = "/User/Login" ;
    return axios({
        url: BackEnd_URL + api_url,
        method: "POST",
        data: fd
    });
}

function userRegister(userEmail, userPassword, userName) {
    let fd = new FormData();
    fd.append("UserEmail", userEmail);
    fd.append("Password", userPassword);
    fd.append("UserName", userName);
    let api_url = "/User/Register" ;
    return axios({
        url: BackEnd_URL + api_url,
        method: "POST",
        data: fd
    });
}

function productGetList() {
    let fd = new FormData();
    let api_url = "/Product/GetList" ;
    return axios({
        url: BackEnd_URL + api_url,
        method: "POST",
        data: fd
    });
}

function productGet(productId){
    let fd = new FormData();
    fd.append("ProductId",productId);
    let api_url = "/Product/Get" ;
    return axios({
        url: BackEnd_URL + api_url,
        method: "POST",
        data: fd
    });
}






export {
    getTest,
    userLogin,
    userRegister,
    productGetList,
    productGet,
}